package top.eggcode.component.dingtalk;

import java.io.UnsupportedEncodingException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;

public class Test {
    public static void main(String[] args) throws UnsupportedEncodingException, NoSuchAlgorithmException, InvalidKeyException {
        DingRobotClientImpl client = new DingRobotClientImpl("https://oapi.dingtalk.com/robot/send?access_token=7b137b7f6c95d99466515c243b4f9bad211df0122a52d4ebcf17d819d861af25", "SEC79b71ddd4a2246b9b9c9a57e8e3d9b433c9a50b9334d4434f9f0eed0a0c13e2d");
/*        DingMessage message = new DingMessage();

        TextBody messageBody = new TextBody();
        messageBody.content = "DingTalkRobotClient 工具类封装测试";
        message.text = messageBody;
        message.msgtype = "text";

        MessageAt at = new MessageAt();
        at.atMobiles.add("15890740460");
        message.at = at;*/

        // plain text

/*        DingMessage message2 = DingMessage.builder()
                .setTextContent("DingTalkRobotClient 工具类封装测试")
                .atMobile("15890740460")
                .toMessage();

        client.pushMessage(message2);*/

        // markdown

        DingMessage message2 = DingMessage.builder()
                .setMarkdownContent("发现接口异常", "## 异常简述\n 车辆不存在")
                .atMobile("15890740460")
                .toMessage();

        client.pushMessage(message2);

    }
}
